#include <iostream>
#include <algorithm>
using namespace std;
int n;
int maxr;
int ans;
struct mons
{
    int num,att;
}r[100005];
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int x;
        scanf("%d",&x);
        r[x].num++;
        r[x].att++;
        maxr=max(maxr,x);
    }
    int i=0,j=1;
    while(i<=j&&j<=maxr)
    {
        if(r[i].num<r[j].att)
        {
            r[j].att-=r[i].num;
            r[i].num=0;
            i++;
        }
        else
        {
            r[i].num-=r[j].att;
            r[j].att=0;
            j++;

        }
        if(i==j)
        {
            j++;
        }
    }
    int ans=0;
    for(int i=1;i<=maxr;i++)
    {
        ans+=r[i].num;
    }
    printf("%d",ans);
    fclose(stdin);
    fclose(stdout);
    return 0;
}
